/*
*    Phantom v2.0 GUI Automation Software
*    Copyright (C) 2009  John C. Van Arsdall (john@phantomtest.com)
*
*    This program is free software; you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation; either version 2 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License along
*    with this program; if not, write to the Free Software Foundation, Inc.,
*    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/

#pragma once

#define MAX_SSI_CHARS 4095

#ifdef _WIN_CE_SCRIPT
  #include <afx.h>
	#define _SSI_NO_LOCALS_
#endif 

#ifdef _WIN_32_SCRIPT
  #include <windows.h>
	#define _SSI_NO_LOCALS_
#endif 

/*
#ifdef _WIN32

	#include <windows.h>
	#define SSI_SCRIPTDLL_API   
	#define _SSI_NO_LOCALS_
#endif
*/

  #ifdef SSI_SCRIPTDLL_EXPORTS
		#define SSI_SCRIPTDLL_API __declspec(dllexport)
  #else
    #define SSI_SCRIPTDLL_API __declspec(dllimport)
  #endif

#ifndef _SSI_NO_LOCALS_

  #define SSI_CHAR    char

#endif

// HERE IS AN IDEA... DO IT AT EACH CONSTRUCTOR AND DESTRUCTOR

#define __USE_DISPLAY_FILE__
#ifdef __USE_DISPLAY_FILE__
	#define SSI_DISPLAY_FILE_NEW printf("+ NEW: %s:%d\n", __FILE__, __LINE__);
	#define SSI_DISPLAY_FILE_DEL printf("- DEL: %s:%d\n", __FILE__, __LINE__);
#else
	#define SSI_DISPLAY_FILE_NEW
	#define SSI_DISPLAY_FILE_DEL
#endif


//#define __DO_PROFILER__
#ifdef __DO_PROFILER__
#include "ssi_Profiler.h"
	#define START_PROFILE(x) SSI_Start_Profiler(x);
	#define STOP_PROFILE(x) SSI_Stop_Profiler(x);
	#define REPORT_PROFILE(x) SSI_Report_Profiler(x);
#else
	#define START_PROFILE(x)
	#define STOP_PROFILE(x)
	#define REPORT_PROFILE(x)
#endif

#define SSI_BOOL char

#define SSI_NULL    0
#define SSI_DWORD   int

#define SSI_CHAR    char
#define CSSI_CHAR   const char
#define CCPTR   const char*
#define sTRUE   "true"
#define sFALSE  "false"
//#define INT8    char
//#define INT16   short
//#define INT32   int
#define SSI_INT64   int  // DOUBLE CHECK

#define SSI_BYTE    char
#define SSI_WORD    short

#define REAL    double

#define SSI_PTR     int

#define dUNKNOWN  0
#define dANY      1
#define RESERVED_TYPES 1

#define oEQUAL    1
#define oNOT      2 
#define oGREATER  4
#define oLESS     8

#define oPLUS        16
#define oMINUS       32
#define oDIVIDE      64
#define oMULTIPLY    128
#define oPOWER       256
#define oMODULOUS    512
#define oDOT			   1024
#define oINCREMENT   2048
#define oDECREMENT   4096
#define oNOT_EQUAL   8192
#define oEQUAL_EQUAL 16384
#define oLOG_AND     32768
#define oLOG_OR      65536
#define oBIT_AND     131072
#define oBIT_OR      262144


#define OPERATOR_LEVEL1		"^"
#define OPERATOR_LEVEL2		"*/%"
#define OPERATOR_LEVEL3		"+-"
#define OPERATOR_LEVEL4		"<>!"
#define OPERATOR_LEVEL5		"&|"
#define OPERATOR_LEVEL6		"="

#define OP_MODE_PASSIVE    0
#define OP_MODE_ACTIVE     1


#define OPERATOR_TOKENS "=+/-*^&|<>!%"
#define OPERATOR_NOT "!"

#define SSI_BRACES              "{}"
#define SSI_PARENS              "()"

#define KEYWORD_SEPARATORS  " "

#define FUNCTION_KEYWORD								"function"

#define FUNCTION_RETURNTYPE_SEPARATOR   " "
#define FUNCTION_NAME_SEPARATOR         "("
#define FUNCTION_PARAM_CLOSER           ")"
#define FUNCTION_PARAM_SEPARATOR        ","
#define FUNCTION_PARAM_TYPE_SEPARATOR   " "

#define FUNCTION_OPEN_BRACE             "{"
#define FUNCTION_CLOSE_BRACE            "}"
#define FUNCTION_BRACES                 "{}"

#define CLASS_OPEN_BRACE		            "{"
#define CLASS_CLOSE_BRACE		            "}"
#define CLASS_BRACES		                "{}"
#define CLASS_NAME_SEPARATORS						" "
#define CLASS_PAR_SEPARATORS						":"
#define CLASS_SUPER_SEPARATOR						":"
#define CLASS_PROT_SEPARATOR						":"
#define CLASS_SUPER_PROT_SEPARATOR      " "
#define CLASS_FUNC_SEPARATOR						"::"
#define CLASS_DECL_ENDERS								"{ "
#define CLASS_MEMBER_SEPARATOR					" "
#define CLASS_EVAL_SEPARATOR						"."
#define CLASS_PUBLIC_STRING							"public"
#define CLASS_PROTECTED_STRING					"protected"
#define CLASS_PRIVATE_STRING						"private"

#define ACCESS_GLOBAL											1
#define ACCESS_LOCAL											2
#define ACCESS_PUBLIC											3
#define ACCESS_PROTECTED									4
#define ACCESS_PRIVATE										5

#define FLOW_FOR_SEPARATOR							";"
#define FLOW_PARAM_START							  "("
#define FLOW_PARAM_END  							  ")"
#define STATEMENT_ENDER									";"

#define Q_SSI_CHAR    '\"'
#define ESCAPE_SSI_CHAR '\\'

#define FLAG_ALPHA        1
#define FLAG_NUMERIC      2
#define FLAG_UNDERSCORE   4
#define FLAG_PERIOD       8
#define FLAG_PUNCTUATION  16
#define FLAG_SPACE        32
#define FLAG_WHITESPACE   64
#define FLAG_NEGATIVE     128

#define FLAG_ALL          FLAG_ALPHA | FLAG_NUMERIC | FLAG_UNDERSCORE | FLAG_PERIOD | FLAG_PUNCTUATION | FLAG_SPACE | FLAG_WHITESPACE | FLAG_NEGATIVE
#define FLAG_ALNUM        3
#define FLAG_VARSSI_CHARS     7
#define FLAG_INT          FLAG_NUMERIC | FLAG_NEGATIVE
#define FLAG_REAL         FLAG_NUMERIC | FLAG_PERIOD | FLAG_NEGATIVE

#define SSI_CHARS_ALPHA       "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
#define SSI_CHARS_NUMERIC     "1234567890"
#define SSI_CHARS_UNDERSCORE  "_"
#define SSI_CHARS_PERIOD      "."
#define SSI_CHARS_PUNCTUATION "!?,.\"'"
#define SSI_CHARS_SPACE       " "
#define SSI_CHARS_WHITESPACE  " \t\n\r"
#define SSI_CHARS_NEGATIVE    "-"
#define SSI_CHARS_DECIMAL			"."

#define DEBUG_MODE    0
#define NORMAL_MODE   1

#define IS_ZERO_BASED_ARRAYS 1

#define __DO_DEBUG  1

#ifndef PI
#define PI      3.14159265358979323846
#endif

#define zap(x) if(x){delete x;} x=SSI_NULL;
#define DEBUG_OUT(x) if(__DO_DEBUG) { cout << "DEBUG: " << x << "\n"; }



